<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>15分钟倒计时</title>
</head>
<body>
<div id="timer" style="color:red"></div>
</body>
<script type="text/javascript"> 
            var oBox= document.getElementById('timer');       
            var maxtime = 6 * 60;  
            function CountDown() {
                if (maxtime >= 0) {
                    minutes = Math.floor(maxtime / 60);
                    seconds = Math.floor(maxtime % 60);
                    msg = minutes + ":" + seconds;
                    oBox.innerHTML = msg;
                    if (maxtime == 5 * 60)alert("还剩5分钟");
                                --maxtime;
                    } else{
                            clearInterval(timer);
                            alert("时间到，结束!");
                        }
                    }
                    timer = setInterval("CountDown()", 1000);                
</script>
</html>
